package com.taotao.complier.calcu.visit;

import com.taotao.complier.calcu.ast.AddSubNode;
import com.taotao.complier.calcu.ast.Expr2Node;
import com.taotao.complier.calcu.ast.ExprNode;
import com.taotao.complier.calcu.ast.FactorNode;
import com.taotao.complier.calcu.ast.MulDivNode;
import com.taotao.complier.calcu.ast.NumNode;
import com.taotao.complier.calcu.ast.Term2Node;
import com.taotao.complier.calcu.ast.TermNode;

/**
 * 打印计算式
 */
public class PrintVisitor implements Visitor {


    private StringBuilder s = new StringBuilder();

    @Override
    public void visitNum(NumNode node) {
        s.append(node.getToken().getVal());

    }

    @Override
    public void visitMulDiv(MulDivNode node) {
        s.append(node.getToken().getVal());
    }

    @Override
    public void visitAddSub(AddSubNode node) {
        s.append(node.getToken().getVal());
    }

    @Override
    public void visitExpr(ExprNode exprNode) {

    }

    @Override
    public void visitTerm(TermNode termNode) {

    }

    @Override
    public void visitTerm2(Term2Node term2Node) {

    }

    @Override
    public void visitExpr2(Expr2Node expr2Node) {

    }

    @Override
    public void visitFactor(FactorNode fatorNode) {

    }


    public String getStatementStr() {
        return s.toString();
    }
}
